#include <Arduino.h>

void init_UART()
{
  Serial.begin(115200);
}

void serial_read_write_more()
{
  if(Serial.available() > 0)
  {
    unsigned char dat[64];
    unsigned char len;//长度的接受变量
    delay(10);
    len = Serial.available();
    Serial.printf("Length:%d",len);
    Serial.println();

    Serial.read(dat,len);
    Serial.write(dat,len);
    Serial.println();

  }

}

void setup() {
  init_UART();
}

void loop() {
 serial_read_write_more();
}
